package com.ruoyi.jjm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.jjm.mapper.UserReceiveMapper;
import com.ruoyi.jjm.domain.UserReceive;
import com.ruoyi.jjm.service.IUserReceiveService;
import com.ruoyi.common.core.text.Convert;

/**
 * 村民收煤记录Service业务层处理
 * 
 * @author tsr
 * @date 2020-07-15
 */
@Service
public class UserReceiveServiceImpl implements IUserReceiveService 
{
    @Autowired
    private UserReceiveMapper userReceiveMapper;

    /**
     * 查询村民收煤记录
     * 
     * @param id 村民收煤记录ID
     * @return 村民收煤记录
     */
    @Override
    public UserReceive selectUserReceiveById(Long id)
    {
        return userReceiveMapper.selectUserReceiveById(id);
    }

    @Override
    public UserReceive selectUserReceiveByUserOrderId(Long userOrderId) {
        return userReceiveMapper.selectUserReceiveByUserOrderId(userOrderId);
    }

    /**
     * 查询村民收煤记录列表
     * 
     * @param userReceive 村民收煤记录
     * @return 村民收煤记录
     */
    @Override
    public List<UserReceive> selectUserReceiveList(UserReceive userReceive)
    {
        return userReceiveMapper.selectUserReceiveList(userReceive);
    }

    /**
     * 新增村民收煤记录
     * 
     * @param userReceive 村民收煤记录
     * @return 结果
     */
    @Override
    public int insertUserReceive(UserReceive userReceive)
    {
        userReceive.setCreateTime(DateUtils.getNowDate());
        return userReceiveMapper.insertUserReceive(userReceive);
    }

    /**
     * 修改村民收煤记录
     * 
     * @param userReceive 村民收煤记录
     * @return 结果
     */
    @Override
    public int updateUserReceive(UserReceive userReceive)
    {
        userReceive.setUpdateTime(DateUtils.getNowDate());
        return userReceiveMapper.updateUserReceive(userReceive);
    }

    /**
     * 删除村民收煤记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteUserReceiveByIds(String ids)
    {
        return userReceiveMapper.deleteUserReceiveByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除村民收煤记录信息
     * 
     * @param id 村民收煤记录ID
     * @return 结果
     */
    @Override
    public int deleteUserReceiveById(Long id)
    {
        return userReceiveMapper.deleteUserReceiveById(id);
    }
}
